<?php
session_start();
include("../controller/ShopCart.class.php");
include("../model/Db.class.php");
$db = new Db();
$s= new ShopCart($db,'goods_shopcart');

$res=$s->checkUserInfo();
if($res['code']==100){
	echo json_encode($res);
	exit;
}
if(isset($_GET['act'])){
	if($_GET['act'] == 'addGoodsToShopCart'){
		$res=$s->addGoodsToShopCart();
		echo json_encode($res);
		exit;
	}
	if($_GET['act'] == 'initShopCart'){
		$res=$s->initShopCart();
		echo json_encode($res);
		exit;
	}
	if($_GET['act'] == 'changeNum'){
		$res=$s->changeNum();
		echo json_encode($res);
		exit;
	}
	if($_GET['act'] == 'delGoods'){
		$res=$s->delGoods();
		echo json_encode($res);
		exit;
	}
	if($_GET['act'] == 'pushOrder'){
		$res=$s->pushOrder();
		echo "<script>alert('".$res['msg']."');window.location.href='../view/index.v.php';</script>";
		// $temp;
		// foreach ($_POST as $goodid) {
		// 	$temp=$goodid;
		// 	echo "<script>alert($temp)</script>";
		// }
	}

}

 ?>